package com.xinfu.newproject.adapter.meter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xinfu.newproject.R;
import com.xinfu.newproject.bean.meter.bean.MeterListBean;

/**
 */
public class ElectricityRefillPullToRefreshAdapter extends BaseQuickAdapter<MeterListBean.ResultBean, BaseViewHolder> {

    Integer position;
    String amount;

    public ElectricityRefillPullToRefreshAdapter() {
        super(R.layout.item_electricity_refill, null);
    }

    public void addAmount(Integer position, String amount) {
        this.position = position;
        this.amount = amount;
        notifyDataSetChanged();
    }

    @Override
    protected void convert(BaseViewHolder helper, MeterListBean.ResultBean item) {
        helper.setText(R.id.item_electricity_refill_ammeter_num, item.getPayMeterNo());
        helper.setText(R.id.item_electricity_refill_tv_name, item.getPayMeterNo());
        helper.setText(R.id.item_electricity_refill_tv_address, item.getAddress());
        helper.setText(R.id.item_electricity_ammeter_tv_dump_energy, item.getRemainUse() + "");
        helper.setText(R.id.item_electricity_refill_tv_total_usage, item.getTotalUse() + "");
        helper.addOnClickListener(R.id.item_electricity_refill_tv_amount);
        helper.addOnClickListener(R.id.item_electricity_refill_tv_recharge);
        if (position != null && position == helper.getPosition()) {
            helper.setText(R.id.item_electricity_refill_tv_amount, amount);
        }
    }


}
